package com.xiaoger.consumer.listener;

import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Map;

/**
 * 直接交换机消息监听器1
 *
 * @author xjx
 * @date 2022/6/7 20:00
 */
@Component
@RabbitListener(queues = "TestDirectQueue")  //监听的队列名称 TestDirectQueue
public class DirectReceiver {

    /**
     * 监听TestDirectQueue队列里边的消息
     *
     * @param message 消息内容
     */
    @RabbitHandler
    public void getDirectMessage(Map message) {
        System.out.println("监听器1收取到的消息内容为："+message.toString());
    }
}
